home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-13 | 14.7 KB | 719 lines | [TEXT/MPS ] |
- /*
- File: TextEditor.r
-
- Contains: TextEditor Resources
-
- Written by: Steve Smith
-
- Copyright: © 1994-95 by Apple Computer, Inc., all rights reserved.
- */
-
- #define SystemSevenOrBetter 1 // we want the extended types
- #define SystemSevenOrLater 1 // Types.r uses this variable
-
- #define qRezzing 1 // Flag for our Def file.
-
- // -- Macintosh Includes --
-
- #include "Types.r"
- #include "SysTypes.r"
- #include "CodeFragmentTypes.r"
-
- // -- OpenDoc Includes --
-
- #ifndef __ODTYPES_R__
- #include "ODTypes.r"
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdDefs_defined
- #include "StdDefs.r"
- #endif
-
- // -- Text Editor Includes --
-
- #ifndef _TEXTEDITORDEF_
- #include "TextEditorDef.h"
- #endif
-
- #ifndef _TEXTEDITORVERS_
- #include "TextEditorVers.h"
- #endif
-
- //-------------------------------------------------------------------------------------
- // .rsrc resources
- //-------------------------------------------------------------------------------------
-
- // TextEditor - This gets the resources from my .rsrc file (PICTs etc.)
- include "TextEditorOther.rsrc";
-
- //-------------------------------------------------------------------------------------
- // Version Resources
- //-------------------------------------------------------------------------------------
-
- resource 'vers' (1)
- {
- currentMajorVersion,
- finderMinorVersion,
- developmentStage,
- preReleaseNumber,
- verUS,
- shortVersionStr,
- shortVersionStr", © Apple Computer, Inc. 1994-1995"
- };
-
- resource 'vers' (2)
- {
- currentMajorVersion,
- finderMinorVersion,
- developmentStage,
- preReleaseNumber,
- verUS,
- "",
- "OpenDoc™ Sample Code"
- };
-
- //-------------------------------------------------------------------------------------
- // Code Fragment Resource
- //-------------------------------------------------------------------------------------
-
- resource 'cfrg' (0)
- {
- { /* [1] */
- #ifdef _68KBUILD_
- kMotorola,
- #else
- kPowerPC,
- #endif
- kFullLib,
- currentVersion,
- compatibleVersion,
- kDefaultStackSize,
- kNoAppSubFolder,
- kIsLib,
- kOnDiskFlat,
- kZeroOffset,
- kWholeFork,
- kTextEditorID, /* this must be the class ID */
-
- /* [2] */
- #ifdef _68KBUILD_
- kMotorola,
- #else
- kPowerPC,
- #endif
- kFullLib,
- currentVersion,
- compatibleVersion,
- kDefaultStackSize,
- kNoAppSubFolder,
- kIsLib,
- kOnDiskFlat,
- kZeroOffset,
- kWholeFork,
- kPartClassName /* this must be the part class name */
- }
- };
-
- //-------------------------------------------------------------------------------------
- // NMAP Resources
- //-------------------------------------------------------------------------------------
-
- // Map a part's kind (unique content identifier)
- // to a generic content category identifier
- resource kODNameMappings (kKindCategoryMapId)
- {
- kODKind,
- { /* array Types: 1 element */
- /* [1] */
- kTextEditorKind,
- kODIsAnISOStringList
- {
- { /* array ClassIDs: 1 element */
- /* [1] */
- kODCategoryStyledText
- }
- }
- }
- };
-
- // Map a part's class id (module::classname)
- // to a part's kind (unique content identifier)
- resource kODNameMappings (kEditorKindMapId)
- {
- kODEditorKinds,
- { /* array Types: 1 element */
- /* [1] */
- kTextEditorID,
- kODIsAnISOStringList
- {
- { /* array ClassIDs: 1 element */
- /* [1] */
- kTextEditorKind
- }
- }
- }
- };
-
- // Map a part's class id (module::classname)
- // to the part editor's name
- resource kODNameMappings (kEditorUserStringMapId)
- {
- kODEditorUserString,
- { /* array Types: 1 element */
- /* [1] */
- kTextEditorID,
- kODIsINTLText
- {
- smRoman,
- langEnglish,
- kTextEditorEditorUserString
- }
- }
- };
-
- // Map a part's kind (unique content identifier)
- // to a human readable string.
- resource kODNameMappings (kKindUserStringMapId)
- {
- kODKindUserString,
- { /* array Types: 1 element */
- /* [1] */
- kTextEditorKind,
- kODIsINTLText
- {
- smRoman,
- langEnglish,
- kTextEditorKindUserString
- }
- }
- };
-
- // Map a part's kind (unique content identifier)
- // to an old style MacOS Type (and/or ScrapType)
- resource kODNameMappings (kOldMacOSTypeMapId)
- {
- kODKindOldMacOSType,
- { /* array KeyList: 1 element */
- /* [1] */
- kTextEditorKind,
- kODIsMacOSType {
- kTextEditorDocumentOSType
- }
- }
- };
-
- // Map a part's class id (module::classname) to
- // the data/file OSTypes the part supports.
- resource kODNameMappings (kPlatformEditorKindMapId)
- {
- kODEditorPlatformKind,
- { /* array KeyList: 1 element */
- /* [1] */
- kTextEditorID,
- kODIsPltfmTypeSpac {
- /* array PltfmTypeSpacList: 3 elements */
- {
- /* [1] */
- kODPlatformDataType,
- kSTXTDataKind,
- smRoman,
- langEnglish,
- kSTXTDataKindUserString,
- kODCategoryStyledText,
-
- /* [2] */
- kODPlatformFileType,
- kTextFileKind,
- smRoman,
- langEnglish,
- kTextFileKindUserString,
- kODCategoryPlainText,
-
- /* [3] */
- kODPlatformDataType,
- kTextDataKind,
- smRoman,
- langEnglish,
- kTextDataKindUserString,
- kODCategoryPlainText,
- }
- }
- }
- };
-
- //-------------------------------------------------------------------------------------
- // User Visible Strings
- //-------------------------------------------------------------------------------------
-
- resource 'STR#' (kRuntimeStringsID, "Menu Items")
- {
- {
- // File Names
- "Text Editor Preferences",
-
- // Menu Text
- "About Text Editor…",
- "Text Editor Preferences…",
- "Preferences…",
- "Show Ruler",
- "Hide Ruler",
- "Show ScriptRunner",
- "Hide ScriptRunner"
- }
- };
-
- resource 'STR#' (kErrorStringsID, "Error strings")
- {
- {
- /* [1] */
- "“TextEditor” was unable completely initi"
- "alize it’s internal structures.",
-
- /* [2] */
- "“TextEditor” was unable to open the docu"
- "ment due to unforseen circumstances.",
-
- /* [3] */
- "“TextEditor” was unable to open a part w"
- "indow due to unforseen circumstances.",
-
- /* [4] */
- "“TextEditor” has been asked to remove a "
- "frame that does not belong to it, or an "
- "error occurred while removing the frame "
- "from internal storage.",
-
- /* [5] */
- "A window that “TextEditor” created has b"
- "een deleted without its knowledge. This "
- "may generate a fatal error in the near f"
- "uture. Please close the document immedia"
- "tely to prevent data loss.",
-
- /* [6] */
- "“TextEditor” was unable to translate the"
- " data on the clipboard due to unforseen "
- "circumstances.",
-
- /* [7] */
- "“TextEditor” was unable to create an obj"
- "ect needed for the basic operation of th"
- "e part. You may be low on memory.",
-
- /* [8] */
- "Display in multiple windows has not been"
- " implemented in this version of the “Tex"
- "tEditor”. A future version may provide t"
- "his feature.",
-
- /* [9] */
- "“TextEditor” encountered a fatal error w"
- "hile trying to save. Try saving again or"
- " closing the document."
- }
- };
-
- //-------------------------------------------------------------------------------------
- // Finder Related Resources
- //-------------------------------------------------------------------------------------
-
- // Kind resources affect the text Finder displays in the
- // "kind" column and file info dialog. This feature was
- // introduced as part of Macintosh Easy Open.
-
- resource 'kind' (kBaseResourceID)
- {
- kTextEditorEditorOSType,
- 0, /* region = USA */
- {
- 'shlb', "OpenDoc™ editor"
- }
- };
-
- resource 'kind' (kBaseResourceID+1)
- {
- kTextEditorViewerOSType,
- 0, /* region = USA */
- {
- 'shlb', "OpenDoc™ viewer"
- }
- };
-
- resource 'kind' (kBaseResourceID+2)
- {
- kODShellSignature,
- 0, /* region = USA */
- {
- kTextEditorDocumentOSType, "TextEditor 1.0 document",
- kTextEditorStationeryOSType, "TextEditor 1.0 stationery"
- }
- };
-
- // The -16397 string will be displayed by Finder when a user
- // tries to open the editor shared library. The string should
- // give the user a little detail about the part's capabilities
- // and enough information to install the part in the correct location.
-
- resource 'STR ' (-16397, purgeable)
- {
- "OpenDoc editor\n"
- "\n"
- "“Text Editor” manipulates text data. To work properly, it "
- "should be placed in the Editors folder. To create a new document, open "
- "a stationery pad."
- };
-
- //-------------------------------------------------------------------------------------
- // Menu Resources
- //-------------------------------------------------------------------------------------
-
- resource 'MENU' (kFontMenuID)
- {
- kFontMenuID,
- textMenuProc,
- allEnabled,
- enabled,
- "Font",
- {
- }
- };
-
- resource 'MENU' (kSizeMenuID)
- {
- kSizeMenuID,
- textMenuProc,
- 0b11111111111111111111110111111111,
- enabled,
- "Size",
- {
- "9 point", noIcon, noKey, noMark, plain,
- "10", noIcon, noKey, noMark, plain,
- "12", noIcon, noKey, noMark, plain,
- "14", noIcon, noKey, noMark, plain,
- "18", noIcon, noKey, noMark, plain,
- "24", noIcon, noKey, noMark, plain,
- "36", noIcon, noKey, noMark, plain,
- "48", noIcon, noKey, noMark, plain,
- "72", noIcon, noKey, noMark, plain,
- "-", noIcon, noKey, noMark, plain,
- "Other…", noIcon, noKey, noMark, plain
- }
- };
-
- resource 'MENU' (kStyleMenuID)
- {
- kStyleMenuID,
- textMenuProc,
- 0b11111111111111111111111111111101,
- enabled,
- "Style",
- {
- "Plain Text", noIcon, "T", noMark, plain,
- "-", noIcon, noKey, noMark, plain,
- "Bold", noIcon, "B", noMark, bold,
- "Italic", noIcon, "I", noMark, italic,
- "Underline", noIcon, "U", noMark, underline,
- "Outline", noIcon, noKey, noMark, outline
- }
- };
-
- resource 'MENU' (kFormatMenuID)
- {
- kFormatMenuID,
- textMenuProc,
- 0b11111111111111111111111111111101,
- enabled,
- "Format",
- {
- "Hide Ruler", noIcon, "H", noMark, plain,
- "-", noIcon, noKey, noMark, plain,
- "Settings…", noIcon, noKey, noMark, plain
- }
- };
-
- resource 'MENU' (kToolsMenuID)
- {
- kToolsMenuID,
- textMenuProc,
- allEnabled,
- enabled,
- "Tools",
- {
- "Show ScriptRunner", noIcon, noKey, noMark, plain
- }
- };
-
- resource 'MENU' (kFontPopupMenuID)
- {
- kFontPopupMenuID,
- 3,
- allEnabled,
- enabled,
- "FontPopup",
- {
- }
- };
-
- //-------------------------------------------------------------------------------------
- // Dialog Resources
- //-------------------------------------------------------------------------------------
-
- // •• About Box Dialog ••
-
- resource 'DLOG' (kAboutDialogID, "About Box")
- {
- {0, 0, 250, 350},
- dBoxProc,
- invisible,
- goAway,
- 0x0,
- kAboutDialogID,
- "",
- alertPositionMainScreen
- };
-
- resource 'DITL' (kAboutDialogID)
- {
- { /* array DITLarray: 8 elements */
- /* [1] */
- {222, 270, 242, 338}, Button { enabled, "OK" },
- /* [2] */
- {24, 25, 56, 57}, Icon { disabled, kEditorIconPicture },
- /* [3] */
- {13, 68, 237, 69}, Button { disabled, "" },
- /* [4] */
- {64, 13, 65, 337}, Button { disabled, "" },
- /* [5] */
- {46, 76, 62, 172}, StaticText { disabled, "Text Editor" },
- /* [6] */
- {76, 76, 116, 304}, StaticText { disabled,
- "Text Editor is a sample part editor which illustrates the functionality "
- "of a non-embedding styled text editor." },
- /* [7] */
- {124, 76, 152, 304}, StaticText { disabled,
- "Written by Steve Smith and Troy Gaul with support from "
- "the OpenDoc™ Engineering team." },
- /* [8] */
- {172, 76, 200, 300}, StaticText { disabled,
- "Copyright © 1994 - 1995 by Apple Computer, Inc. All Rights Reserved." },
- /* [9] */
- {51, 272, 64, 340}, StaticText { disabled,
- "Version "shortVersionStr }
- }
- };
-
- resource 'dctb' (kAboutDialogID)
- {
- { /* array ColorSpec: 5 elements */
- /* [1] */
- wContentColor, 59127, 59127, 59127,
- /* [2] */
- wFrameColor, 0, 0, 0,
- /* [3] */
- wTextColor, 0, 0, 0,
- /* [4] */
- wHiliteColor, 0, 0, 0,
- /* [5] */
- wTitleBarColor, 65535, 65535, 65535
- }
- };
-
- data 'ictb' (kAboutDialogID)
- {
- /* dialog control text styling */
- $"0000000000000000002800240028"
- $"004C80070074800700888007009C"
- $"800700B0800700C4000000000000"
- $"000300007FFF7FFF7FFF0001FFFF"
- $"FFFFFFFF00020000000000000003"
- $"FFFFFFFFFFFF0000000000000003"
- $"00007FFF7FFF7FFF0001FFFFFFFF"
- $"FFFF00020000000000000003FFFF"
- $"FFFFFFFF00D80100000E00000000"
- $"0000FFFFFFFFFFFF000000E10000"
- $"0009000000000000FFFFFFFFFFFF"
- $"000000E800000009000000000000"
- $"FFFFFFFFFFFF000000EF00000009"
- $"000000000000FFFFFFFFFFFF0000"
- $"00F600000009000000000000FFFF"
- $"FFFFFFFF00000850616C6174696E"
- $"6F0647656E6576610647656E6576"
- $"610647656E6576610647656E6576"
- $"61"
- };
-
- // -- Error Box Dialog --
-
- resource 'DLOG' (kErrorBoxID, "Error Box")
- {
- {57, 46, 244, 374},
- dBoxProc,
- invisible,
- goAway,
- 0x0,
- kErrorBoxID,
- "",
- alertPositionMainScreen
- };
-
- resource 'DITL' (kErrorBoxID)
- {
- { /* array DITLarray: 5 elements */
- /* [1] */
- {153, 256, 173, 314}, Button { enabled, "OK" },
- /* [2] */
- {153, 185, 173, 243}, Button { enabled, "Cancel" },
- /* [3] */
- {11, 70, 124, 317}, StaticText { disabled,
- "<< Use this for errors in the Editor, such as out of memory, "
- "unable to acquire some system resource, etc.>> \nUser errors "
- "use a standard alert appearance. See DITL 129.>>" },
- /* [4] */
- {11, 19, 43, 51}, Icon { disabled, kEditorIconPicture },
- /* [5] */
- {149, 252, 177, 318}, UserItem { disabled }
- }
- };
-
- /*
-
- •••
- Since these dialogs are graphically-oriented, we will include
- them from the .rsrc file rather than including the Rez version
- here.
- •••
-
- Dialogs that can be found in the .rsrc file are those with the
- following IDs:
- kPreferencesDialogID
- kSettingsDialogID
- kSettingsNoMarginsDialogID
- kOtherSizeDialogID
- */
-
-
- #define Geneva 3
-
- resource 'finf' (kDialogFontInfoID, "Dialog Font Info")
- {
- { /* array Fonts: 3 elements */
- /* [1] */
- Geneva, plain, 10,
- /* [2] */
- Geneva, plain, 10,
- /* [3] */
- Geneva, plain, 10,
- }
- };
-
- //-------------------------------------------------------------------------------------
- // Finder Bundle Information
- //-------------------------------------------------------------------------------------
-
- resource 'BNDL' (kDocumentBundle, "Document BNDL")
- {
- kODShellSignature,
- 0,
- { /* array TypeArray: 2 elements */
- /* [1] */
- 'FREF',
- { /* array IDArray: 2 elements */
- /* [1] */
- 0, kDocumentFREF,
- /* [2] */
- 1, kStationeryFREF
- },
- /* [2] */
- 'ICN#',
- { /* array IDArray: 2 elements */
- /* [1] */
- 0, kDocumentIcons,
- /* [2] */
- 1, kStationeryIcons
- }
- }
- };
-
- resource 'BNDL' (kEditorBundle, "Editor BNDL")
- {
- kTextEditorEditorOSType,
- 0,
- { /* array TypeArray: 2 elements */
- /* [1] */
- 'FREF',
- { /* array IDArray: 1 element */
- /* [1] */
- 0, kEditorFREF
- },
- /* [2] */
- 'ICN#',
- { /* array IDArray: 1 element */
- /* [1] */
- 0, kEditorIcons
- }
- }
- };
-
- resource 'BNDL' (kViewerBundle, "Viewer BNDL")
- {
- kTextEditorViewerOSType,
- 0,
- { /* array TypeArray: 2 elements */
- /* [1] */
- 'FREF',
- { /* array IDArray: 1 element */
- /* [1] */
- 0, kViewerFREF
- },
- /* [2] */
- 'ICN#',
- { /* array IDArray: 1 element */
- /* [1] */
- 0, kViewerIcons
- }
- }
- };
-
- resource 'FREF' (kDocumentFREF)
- {
- kTextEditorDocumentOSType,
- 0,
- ""
- };
-
- resource 'FREF' (kStationeryFREF)
- {
- kTextEditorStationeryOSType,
- 1,
- ""
- };
-
- resource 'FREF' (kEditorFREF)
- {
- 'shlb',
- 0,
- ""
- };
-
- resource 'FREF' (kViewerFREF)
- {
- 'shlb',
- 0,
- ""
- };
-
- data kODShellSignature (0, "Owner resource")
- {
- $"00"
- };
-
- data kTextEditorEditorOSType (0, "Owner resource")
- {
- $"00"
- };
-
- data kTextEditorViewerOSType (0, "Owner resource")
- {
- $"00"
- };
-